import Vuex from "vuex"
import { routes } from '../router/index'
import Vue from "vue"
Vue.use(Vuex)
const store = new Vuex.Store({
    state: {
        routes: [],
        asyncRoutes: []
    },
    getters: {},
    mutations: {
        SET_ROUTES(state, payload) {
            state.routes = routes[1].children.concat(payload.routes)
            state.asyncRoutes = payload.routes
        }
    },
    actions: {
        SET_ROUTES({ commit }, routes) {
            commit({ type: 'SET_ROUTES', routes })
        }
    }
})
export default store